<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="menus">
      <button id="btnDel">删除</button>
      <button id="btnAdd">添加</button>
      <button id="btnEdit">编辑</button>
    </div>

    <script>
      const menus = document.getElementById("menus");
      menus.onclick = function (e) {
        switch (e.target.id) {
          case "btnAdd":
            console.log("Add");
            break;
          case "btnDel":
            console.log("Del");
            break;
          case "btnEdit":
            console.log("Edit");
            break;
        }
      };
    </script>
  </body>
</html>
